{$layout}

<div>
    <h3>安全设置</h3>
    <p class="comment">你当前的IP：{{userIP}}，记得不要把自己也阻挡在外哦。</p>
    <form class="ui form" data-tea-action=".security">
        <table class="ui table definition selectable">
            <tr>
                <td class="title">允许访问的IP</td>
                <td>
                    <div class="ui field">
                        <div class="ui toggle checkbox">
                            <input type="checkbox" name="allowAll" value="1" v-model="allowAll"/>
                            <label class="grey">允许<strong>所有</strong>的IP</label>
                        </div>
                    </div>
                    <div v-if="!allowAll" id="allow-ips-box">
						<single-value-list prefix="allowIP" value-name="IP地址" :values="security.allow"></single-value-list>
                        <p class="comment">如果允许的IP中包含0.0.0.0，表示允许所有的IP访问。支持IP范围比如192.168.1.100/24，或者192.168.1.1,192.168.1.100。</p>
                    </div>
                </td>
            </tr>
            <tr>
                <td>禁止访问的IP</td>
                <td id="deny-ips-box">
					<single-value-list prefix="denyIP" value-name="IP地址" :values="security.deny"></single-value-list>
					<p class="comment">支持IP范围比如192.168.1.100/24，或者192.168.1.1,192.168.1.100。</p>
                </td>
            </tr>
			<tr>
				<td>目录自动补全</td>
				<td>
					<div class="ui checkbox">
						<input type="checkbox" name="dirAutoComplete" value="1" v-model="security.dirAutoComplete" />
						<label></label>
					</div>
					<p class="comment">在某些界面输入目录时，支持自动补全。</p>
				</td>
			</tr>
			<tr>
				<td>登录界面URL</td>
				<td>
					<input type="text" name="loginURL" v-model="security.loginURL" placeholder="类似于 /login"/>
					<p class="comment">可以重新定义登录界面的URL，但需要重启后才能生效</p>
				</td>
			</tr>
			<tr>
				<td>登录密码加密方式</td>
				<td>
					<select name="passwordEncryptType" v-model="security.passwordEncryptType" class="ui dropdown" style="width:4em">
						<option v-for="t in types" :value="t.code">{{t.name}}</option>
					</select>
					<p class="comment">修改后再次修改密码后才有效。</p>
				</td>
			</tr>
        </table>

        <button class="ui button primary" type="submit">保存</button>
    </form>
</div>